﻿using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace Core.Entities.Stock
{
    /// <summary>
    /// 入库记录实体
    /// </summary>
    public class StockIn: BaseEntity<string>
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public override string Id { get; set; }

        /// <summary>
        /// 物料编码
        /// </summary>
        public string? MaterCode { get; set; }

        /// <summary>
        /// 物料名称
        /// </summary>
        public string? MaterName { get; set; }

        /// <summary>
        /// 物料分类
        /// </summary>
        public string? MaterType { get; set; }

        /// <summary>
        /// 仓库ID
        /// </summary>
        public string? WarehouseID { get; set; }

        ///</summary>
        /// 仓库名称
        /// </summary>
        public string? WarehouseName { get; set; }

        /// <summary>
        /// 库位ID
        /// </summary>
        public string? LocationID { get; set; }

        /// <summary>
        /// 库位名称
        /// </summary>
        public string? LocationName { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string? Unit { get; set; }

        /// <summary>
        /// 入库数量
        /// </summary>
        public decimal? In_Quantity { get; set; }

        /// <summary>
        /// 入库时间
        /// </summary>
        public DateTime? In_Time { get; set; }

        /// <summary>
        /// 入库类型
        /// </summary>
        public string? In_Type { get; set; }

        /// <summary>
        /// 入库批次号
        /// </summary>
        public string? In_BatchCode { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        public string? Spec { get; set; }

        /// <summary>
        /// 筒仓编码
        /// </summary>
        public string? SiloCode { get; set; }

        /// <summary>
        /// 筒仓名称
        /// </summary>
        public string? SiloName { get; set; }

        /// <summary>
        /// 软删除标记
        /// </summary>
        public bool IsDeleted { get; set; }
        public StockIn()
        {
            // 如果ID为空，自动生成GUID
            if (string.IsNullOrEmpty(Id))
            {
                Id = Guid.NewGuid().ToString();
            }
        }
        #region 拓展字段
        /// <summary>
        /// 时间范围查询
        /// </summary>
        [NotMapped]
        public string? InTimeScope { get; set; }
        #endregion
    }
}